var initialState = {
    userInfo: { token: '' },
}


export default function reducer(state = initialState, action: any) {

    var newstate = JSON.parse(JSON.stringify(state))


    if (action.type == 'SAVE_USERINFO') {

        newstate.userInfo = action.payload

    } else if (action.type == 'REMOVE_TOKEN') {

        newstate.userInfo = { token: '' };

    }else {
        return state
    }

    return newstate
}